import { LOGIN } from '../constants/user'

export interface UserProps {
  nickName: string;
  avatarUrl: string;
  userId: string;
}

const INITIAL_STATE: UserProps = {
  nickName: '',
  avatarUrl: '',
  userId: ''
}

export default function user (state = INITIAL_STATE, action) {
  switch (action.type) {
    case LOGIN:
      return {
        ...state,
        ...action.user
      }
     default:
       return state
  }
}
